package com.itheima.AOP;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class Teacher {
    @Pointcut("execution(* *..*(..))")
    public void pt(){}

   @Around("pt()")
   public Object around(ProceedingJoinPoint pjp) {
       System.out.println("前置");
       Object ret = null;
       try {
           //对原始方法的调用
           ret = pjp.proceed();

           System.out.println("返回后");
       } catch (Throwable throwable) {
           System.out.println("异常");
       } finally {
           System.out.println("后置");
       }
       return ret;
   }

}
